function setCookie(c_name, value, expiredays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" + escape(value)
			+ ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
	if (document.cookie.length > 0) {
		c_start = document.cookie.indexOf(c_name + "=");
		if (c_start != -1) {
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf(";", c_start);
			if (c_end == -1)
				c_end = document.cookie.length;
			return unescape(document.cookie.substring(c_start, c_end));
		}
	}
	return "";
}

function getParam(url, paraname) {
	var regStr = "(?:^.+[?&]" + paraname + "=)(.*?)(?=(&.*|$))";
	var reg = new RegExp(regStr, "i");
	if (reg.test(url))
		return decodeURIComponent(RegExp.$1);
}
/**
 * 向URL添加参数，若URL已包含该参数则覆盖，否则添加
 * @param url
 * @param paramname
 * @param paramvalue
 */
function setParam(url, paramname, paramvalue) {
	if (!paramname || paramvalue == undefined)
		return url;
	paramvalue = encodeURIComponent(paramvalue);
	/* 覆盖值 */
	/* $1 从开始到region= $2 region的值 */
	var str = "(^.+[?&]" + paramname + "=)(.*?)(?=(&.*|$))";
	var reg = new RegExp(str, "i");
	if (reg.exec(url)) {
		return url.replace(reg, "$1" + paramvalue);
	}
	/* 添加新值 */
	/* 是否包含 ？ */
	reg = /^.+\?((?=\b)|(?=$))/i;
	if (reg.test(url)) {
		url = url + "&" + paramname + "=" + paramvalue;
	} else {
		url = url + "?" + paramname + "=" + paramvalue;
	}
	return url;
};